
import builder.RecursiveBuilder;
import java.io.StringReader;
import java.util.Scanner;
import visitor.EvalutationCond;
import visitor.VisitPostfix;
import visitor.VisitSymmetric;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Antonio
 */
public class EspressioniCondizionali {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        System.out.print("Fornisci l'espressione: ");
        String combinazione = sc.nextLine();

        StringReader sr = new StringReader(combinazione);
        RecursiveBuilder parser = new RecursiveBuilder(sr);

        System.out.print("Fornisci il nome del file property: ");
        String nomeFileProperty = sc.nextLine();

        parser.getCond().interpreta(nomeFileProperty);

        EvalutationCond ev = new EvalutationCond();
        parser.getCond().accept(ev);
        System.out.println("\nESPRESSIONE: " + parser.getCond() + " --> " + ev.getResult());

        VisitSymmetric vs = new VisitSymmetric();
        parser.getCond().accept(vs);
        System.out.println(vs.toString());

        VisitPostfix vp = new VisitPostfix();
        parser.getCond().accept(vp);
        System.out.println(vp.toString());
    }
}
